package IOStreamStudy.printWriter;

import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * private PrintWriter(Charset charset, File file)  可以指定编码方式,和输出位置
 * PrintWriter比printStream更强大
 * */
public class PrintWriterDemo {
    public static void main(String[] args) throws IOException {
        PrintWriter printWriter = new PrintWriter(new FileWriter("D:\\all_projects\\java_projects\\java_ij" +
                "\\springMVC\\NetWork\\src\\cn\\usts\\edu\\IOStreamStudy\\printStream\\a.txt"));
        printWriter.println("hello 你好java");
        printWriter.close();// 关闭才会将数据写入到文件中,否则不会写入
    }
}
